REBOL [
	Title: "RebGUI requestors"
	Owner: "Ashley G Truter"
	Purpose: "Requestor functions."
	Acknowledgements: {
		request-calc based on http://www.rebol.org/view-script.r?script=mini-calc.r
		request-date based on the work of Carl Sassenrath's VID function of the same name
		request-file based on the work of Carl Sassenrath's VID function of the same name
	}
]

requestors: make object! [

	;
	;	--- Color spec ---
	;

	color-spec: copy [text-size 15 space 1x1]

	do make function! [/local bx r g b i] [
		bx: 4 + length? locale*/colors
		r: bx - 1
		g: bx + 2
		b: bx + 4
		i: 1
		foreach color locale*/colors [
			insert tail color-spec compose/deep [
				box 5x5 (color) [face/parent-face/pane/(bx)/action/on-click face] edge [] feel [
					over: make function! [face act pos /local p] [
						all [
							act
							p: face/parent-face/pane
							p/(bx)/color: face/color
							p/(r)/text: form face/color/1
							p/(g)/text: form face/color/2
							p/(b)/text: form face/color/3
							set-title face (uppercase/part form color 1)
						]
					]
				]
			]
			all [zero? i // 8 insert tail color-spec 'return]
			i: i + 1
		]
		all ['return <> last color-spec insert tail color-spec 'return]
	]

	read-dir: make function! [path /local blk dirs] [
		blk: copy []
		if dirs: attempt [read path] [
			foreach dir remove-each file sort dirs [any [#"/" <> last file #"." = first file]] [
				insert tail blk head remove back tail dir
				insert/only tail blk read-dir dirize path/:dir
				if empty? last blk [remove back tail blk]
			]
		]
		blk
	]

	;
	;	Requestors
	;

	#include %requestors/alert.r
	#include %requestors/confirm.r
	#include %requestors/editor.r
	#include %requestors/flash.r
	#include %requestors/request.r
	#include %requestors/request-about.r
	#include %requestors/request-calc.r
	#include %requestors/request-char.r
	#include %requestors/request-color.r
	#include %requestors/request-date.r
	#include %requestors/request-dir.r
	#include %requestors/request-email.r
	#include %requestors/request-error.r
	#include %requestors/request-file.r
	#include %requestors/request-font.r
	#include %requestors/request-list.r
	#include %requestors/request-menu.r
	#include %requestors/request-pass.r
	#include %requestors/request-progress.r
	#include %requestors/request-spellcheck.r
	#include %requestors/request-value.r
	#include %requestors/request-verify.r
	#include %requestors/splash.r
]

foreach word find first requestors 'alert [
	set to word! word get in requestors word
]